import java.awt.Color;

public class ProcessNode {

	private static final int MAX_ARRIVAL_TIME = 60;
	private static final int MAX_SERVICE_TIME = 60;
	
	private String processName;
	private Color color;
	private int arrivalTime;
	private int serviceTime;
	public Simulation mysim;
	private int times_ran;

	public ProcessNode(String processName, Simulation mysim) {
		this.mysim = mysim;
		this.processName = processName;
		this.arrivalTime = (int)(Math.random() * MAX_ARRIVAL_TIME)+5;
		this.serviceTime = (int)(Math.random() * MAX_SERVICE_TIME)+5;
		this.color = new Color(((float)Math.random() * 0.8f)+0.1f,
								((float)Math.random() * 0.8f)+0.1f,
								((float)Math.random() * 0.8f)+0.1f);
		this.times_ran = 0;
	}
	
	
	public Color getColor() {
		return color;
	}


	public void setColor(Color color) {
		this.color = color;
	}
	public boolean hasArrived(int time) {
		if(time >= arrivalTime)
			return true;
		else
			return false;
	
	}

	public String getProcessName() {
		return processName;
	}

	public void setProcessName(String processName) {
		this.processName = processName;
	}

	public void setArrivalTime(int arrivalTime) {
		this.arrivalTime = arrivalTime;
	}
	public int getArrivalTime() {
		return arrivalTime;
	}

	public int getServiceTime() {
		return serviceTime;
	}

	public void setServiceTime(int serviceTime) {
		this.serviceTime = serviceTime;
	}
	

	public Simulation getMysim() {
		return mysim;
	}


	public void setMysim(Simulation mysim) {
		this.mysim = mysim;
	}
	public void incrementTimesRan()
	{
		times_ran++;
	}
	public int getTimesRan() {
		return times_ran;
	}


	

	
}
